package scau.erps.service.impl;

import java.util.List;

import org.nutz.dao.Cnd;
import org.nutz.dao.util.cri.SqlExpressionGroup;
import org.nutz.service.IdEntityService;

import scau.erps.entity.Extrascore;
import scau.erps.service.ExtrascoreService;

/**
 * 盘面报表分数服务实现类
 * @author FYJ
 *
 */
public class ExtrascoreServiceImpl extends IdEntityService<Extrascore> implements ExtrascoreService{

	@Override
	public List<Extrascore> getExtrascores(int teamid) {
		SqlExpressionGroup e1 = null;
		if(teamid != 0){
			e1 = Cnd.exps("team_id", "=", teamid);			
		}
		return this.query(Cnd.where(e1), null);
	}

	@Override
	public void updateExtrascore(Extrascore extrascore) {
		this.dao().update(extrascore);
		
	}

	@Override
	public List<Extrascore> getExtrascore(int teamid, String year) {
		SqlExpressionGroup e1 = null;
		SqlExpressionGroup e2 = null;
		if(teamid != 0){
			e1 = Cnd.exps("team_id", "=", teamid);			
		}
		if(year !=null){
			String Y = year.charAt(0) +""+year.charAt(1);
			e2 = Cnd.exps("year", "=", Y);			
		}
		return this.query(Cnd.where(e1).and(e2), null);
	}

	
}
